IDL Programming > Concepts > String Operations

String Operations

IDL supports several basic string operations, as described below:

String Operations

Operation

Description

Concatenation

The Addition operator, “+”, can be used to concatenate strings together.

Formatting Data

The STRING function is used to format data into a string. The READS procedure can be used to read values from a string into IDL variables.

Case Folding

The STRLOWCASE function returns a copy of its string argument converted to lowercase. Similarly, the STRUPCASE function converts its argument to uppercase. See Case Folding.

White Space Removal

The STRCOMPRESS and STRTRIM functions can be used to eliminate unwanted white space (blanks or tabs) from their string arguments.

Length

The STRLEN function returns the length of its string argument. See Finding the Length of a String.

Substrings

The STRPOS , STRPUT , and STRMID routines locate, insert, and extract substrings from their string arguments. See Substrings.

Splitting and Joining Strings

The STRSPLIT function is used to break strings apart, and the STRJOIN function can be used to join them.

Comparing Strings

The STRCMP , STRMATCH , and STREGEX functions perform string comparisons. See Comparing Strings.